{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 基于隐马尔可夫实现命名实体识别"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 导入相关的库"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import pandas as pd\n",
    "import json\n",
    "from seqeval.metrics import  classification_report\n",
    "import tqdm"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 读入数据"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "每一行是一个json字典，我们逐行读入后处理"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "with open('train.json', encoding='utf-8') as f:\n",
    "    data = f.readlines()\n",
    "data = [json.loads(i) for i in data]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 数据的预处理"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "先定义标签"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "* 地址 address ADS ADM ADE\n",
    "* 书名 book BS BM BE\n",
    "* 公司 company CS CM CE\n",
    "* 游戏 game GS GM GE\n",
    "* 政府 goverment GOS GOM GOE\n",
    "* 电影 movie MS  MM ME\n",
    "* 姓名 name NS NM NE\n",
    "* 组织机构 organization OS OM OE\n",
    "* 职位 position PS PM PE\n",
    "* 景点 scene SS SM SE\n",
    "* 其他 E"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "基于标签对数据进行标注"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "dataset = []\n",
    "for info in data:\n",
    "    dic = {}\n",
    "    text = info['text'] \n",
    "    tag = ['E' for i in range(len(text))]\n",
    "    for label in info['label']:\n",
    "        for i in info['label'][label]:\n",
    "            for j in info['label'][label][i]:\n",
    "                if label == 'address':\n",
    "                    tag[j[0]] = 'ADS'\n",
    "                    tag[j[1]] = 'ADE'\n",
    "                    for k in range(j[0]+1, j[1]):\n",
    "                        tag[k] = 'ADM'\n",
    "                    \n",
    "                elif label == 'book':\n",
    "                    tag[j[0]] = 'BS'\n",
    "                    tag[j[1]] = 'BE'\n",
    "                    for k in range(j[0]+1, j[1]):\n",
    "                        tag[k] = 'BM'\n",
    "\n",
    "                elif label == 'company':\n",
    "                    tag[j[0]] = 'CS'\n",
    "                    tag[j[1]] = 'CE'\n",
    "                    for k in range(j[0]+1, j[1]):\n",
    "                        tag[k] = 'CM'\n",
    "\n",
    "                elif label == 'game':\n",
    "                    tag[j[0]] = 'GS'\n",
    "                    tag[j[1]] = 'GE'\n",
    "                    for k in range(j[0]+1, j[1]):\n",
    "                        tag[k] = 'GM'\n",
    "\n",
    "                elif label == 'government':\n",
    "                    tag[j[0]] = 'GOS'\n",
    "                    tag[j[1]] = 'GOE'\n",
    "                    for k in range(j[0]+1, j[1]):\n",
    "                        tag[k] = 'GOM'\n",
    "\n",
    "                elif label == 'movie':\n",
    "                    tag[j[0]] = 'MS'\n",
    "                    tag[j[1]] = 'ME'\n",
    "                    for k in range(j[0]+1, j[1]):\n",
    "                        tag[k] = 'MM'\n",
    "\n",
    "                elif label == 'name':\n",
    "                    tag[j[0]] = 'NS'\n",
    "                    tag[j[1]] = 'NE'\n",
    "                    for k in range(j[0]+1, j[1]):\n",
    "                        tag[k] = 'NM'\n",
    "\n",
    "                elif label == 'organization':\n",
    "                    tag[j[0]] = 'OS'\n",
    "                    tag[j[1]] = 'OE'\n",
    "                    for k in range(j[0]+1, j[1]):\n",
    "                        tag[k] = 'OM'\n",
    "\n",
    "                elif label == 'position':\n",
    "                    tag[j[0]] = 'PS'\n",
    "                    tag[j[1]] = 'PE'\n",
    "                    for k in range(j[0]+1, j[1]):\n",
    "                        tag[k] = 'PM'\n",
    "                else:\n",
    "                    tag[j[0]] = 'SS'\n",
    "                    tag[j[1]] = 'SE'\n",
    "                    for k in range(j[0]+1, j[1]):\n",
    "                        tag[k] = 'SM'\n",
    "    \n",
    "    dic['text'] = text\n",
    "    dic['tag'] = tag\n",
    "    dataset.append(dic)\n",
    "        "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "标注后的结果如下所示"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'text': '浙商银行企业信贷部叶老桂博士则从另一个角度对五道门槛进行了解读。叶老桂认为，对目前国内商业银行而言，',\n",
       " 'tag': ['CS',\n",
       "  'CM',\n",
       "  'CM',\n",
       "  'CE',\n",
       "  'E',\n",
       "  'E',\n",
       "  'E',\n",
       "  'E',\n",
       "  'E',\n",
       "  'NS',\n",
       "  'NM',\n",
       "  'NE',\n",
       "  'E',\n",
       "  'E',\n",
       "  'E',\n",
       "  'E',\n",
       "  'E',\n",
       "  'E',\n",
       "  'E',\n",
       "  'E',\n",
       "  'E',\n",
       "  'E',\n",
       "  'E',\n",
       "  'E',\n",
       "  'E',\n",
       "  'E',\n",
       "  'E',\n",
       "  'E',\n",
       "  'E',\n",
       "  'E',\n",
       "  'E',\n",
       "  'E',\n",
       "  'E',\n",
       "  'E',\n",
       "  'E',\n",
       "  'E',\n",
       "  'E',\n",
       "  'E',\n",
       "  'E',\n",
       "  'E',\n",
       "  'E',\n",
       "  'E',\n",
       "  'E',\n",
       "  'E',\n",
       "  'E',\n",
       "  'E',\n",
       "  'E',\n",
       "  'E',\n",
       "  'E',\n",
       "  'E']}"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dataset[0]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 进行参数的初始化"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "建立了三个矩阵\n",
    "* init_mat 初始矩阵\n",
    "* transform 转换矩阵\n",
    "* singleword 发射矩阵"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "total_label = ['ADS', 'ADM', 'ADE', 'BS', 'BM', 'BE', 'CS', 'CM', 'CE', 'GS', 'GM',\n",
    "               'GE', 'GOS', 'GOM', 'GOE', 'MS',  'MM', 'ME', 'NS', 'NM', 'NE', 'OS',\n",
    "               'OM', 'OE', 'PS', 'PM', 'PE', 'SS', 'SM', 'SE', 'E']\n",
    "init_mat = {}\n",
    "transform_mat = {}\n",
    "singleword_mat = {}\n",
    "for label in total_label:\n",
    "    init_mat[label] = 0\n",
    "    transform_mat[label] = {}\n",
    "    for label2 in total_label:\n",
    "        transform_mat[label][label2]=0"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "下面进行矩阵值的填充"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "for data_item in dataset:\n",
    "    init_mat[data_item['tag'][0]] +=1\n",
    "    for i in range(len(data_item['tag'])-1):\n",
    "        transform_mat[data_item['tag'][i]][data_item['tag'][i+1]] +=1\n",
    "    for i in range(len(data_item['text'])):\n",
    "        if data_item['text'][i] not in singleword_mat:\n",
    "            singleword_mat[data_item['text'][i]] ={}\n",
    "            for j in total_label:\n",
    "                singleword_mat[data_item['text'][i]][j] = 0\n",
    "        else:\n",
    "            singleword_mat[data_item['text'][i]][data_item['tag'][i]] += 1"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "我们将得到的数据转化成DataFrame，以便与可视化和后续计算"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>ADS</th>\n",
       "      <th>ADM</th>\n",
       "      <th>ADE</th>\n",
       "      <th>BS</th>\n",
       "      <th>BM</th>\n",
       "      <th>BE</th>\n",
       "      <th>CS</th>\n",
       "      <th>CM</th>\n",
       "      <th>CE</th>\n",
       "      <th>GS</th>\n",
       "      <th>...</th>\n",
       "      <th>OS</th>\n",
       "      <th>OM</th>\n",
       "      <th>OE</th>\n",
       "      <th>PS</th>\n",
       "      <th>PM</th>\n",
       "      <th>PE</th>\n",
       "      <th>SS</th>\n",
       "      <th>SM</th>\n",
       "      <th>SE</th>\n",
       "      <th>E</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>init</th>\n",
       "      <td>318</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>264</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>661</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>406</td>\n",
       "      <td>...</td>\n",
       "      <td>452</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>244</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>197</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>7018</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>1 rows × 31 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      ADS  ADM  ADE   BS  BM  BE   CS  CM  CE   GS  ...   OS  OM  OE   PS  PM  \\\n",
       "init  318    0    0  264   0   0  661   0   0  406  ...  452   0   0  244   0   \n",
       "\n",
       "      PE   SS  SM  SE     E  \n",
       "init   0  197   0   0  7018  \n",
       "\n",
       "[1 rows x 31 columns]"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "init_mat = pd.DataFrame(init_mat,index=['init'])\n",
    "init_mat"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>ADS</th>\n",
       "      <th>ADM</th>\n",
       "      <th>ADE</th>\n",
       "      <th>BS</th>\n",
       "      <th>BM</th>\n",
       "      <th>BE</th>\n",
       "      <th>CS</th>\n",
       "      <th>CM</th>\n",
       "      <th>CE</th>\n",
       "      <th>GS</th>\n",
       "      <th>...</th>\n",
       "      <th>OS</th>\n",
       "      <th>OM</th>\n",
       "      <th>OE</th>\n",
       "      <th>PS</th>\n",
       "      <th>PM</th>\n",
       "      <th>PE</th>\n",
       "      <th>SS</th>\n",
       "      <th>SM</th>\n",
       "      <th>SE</th>\n",
       "      <th>E</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>ADS</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>19</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>21</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>7</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>5</td>\n",
       "      <td>2498</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>ADM</th>\n",
       "      <td>1907</td>\n",
       "      <td>6447</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>ADE</th>\n",
       "      <td>982</td>\n",
       "      <td>1907</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>BS</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>62</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>777</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>BM</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1100</td>\n",
       "      <td>4402</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>BE</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>38</td>\n",
       "      <td>1101</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>CS</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>11</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>11</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>10</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2265</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>CM</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2173</td>\n",
       "      <td>5740</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>CE</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>790</td>\n",
       "      <td>2173</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>17</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>GS</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>15</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>8</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1908</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>GM</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2220</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>GE</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>156</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>GOS</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1475</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>GOM</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>GOE</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>MS</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>890</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>MM</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>ME</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>NS</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>14</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>9</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2010</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>NM</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>NE</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>OS</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>7</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>45</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2685</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>OM</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>2222</td>\n",
       "      <td>3627</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>OE</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>988</td>\n",
       "      <td>2222</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>PS</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>46</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>65</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>257</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>160</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>13</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>8</td>\n",
       "      <td>1983</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>PM</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1391</td>\n",
       "      <td>1184</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>PE</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1749</td>\n",
       "      <td>1391</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>SS</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>8</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>47</td>\n",
       "      <td>1269</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>SM</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1325</td>\n",
       "      <td>2379</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>SE</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>196</td>\n",
       "      <td>1325</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>E</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2700</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>904</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2615</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2899</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2087</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1438</td>\n",
       "      <td>266917</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>31 rows × 31 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      ADS   ADM   ADE    BS    BM   BE    CS    CM    CE    GS  ...    OS  \\\n",
       "ADS     0     0    19     0     0    4     0     0    21     0  ...     0   \n",
       "ADM  1907  6447     0     0     0    0     0     0     0     0  ...     0   \n",
       "ADE   982  1907     0     0     0    0     0     0     0     0  ...     0   \n",
       "BS      0     0     5     0     0   62     0     0     0     0  ...     0   \n",
       "BM      0     0     0  1100  4402    0     0     0     2     0  ...     0   \n",
       "BE      0     0     0    38  1101    0     0     0     0     0  ...     0   \n",
       "CS      0     0    11     1     1    0     0     0    11     0  ...     0   \n",
       "CM      0     0     0     0     0    0  2173  5740     0     0  ...     0   \n",
       "CE      0     0     0     0     0    0   790  2173     0     0  ...     0   \n",
       "GS      0     0     3     0     0    0     0     0    15     0  ...     0   \n",
       "GM      0     0     0     0     0    0     0     0     0  2220  ...     0   \n",
       "GE      0     0     0     0     0    0     0     0     0   156  ...     0   \n",
       "GOS     0     0     0     0     0    0     0     0     0     0  ...     0   \n",
       "GOM     0     0     0     0     0    0     0     0     0     0  ...     0   \n",
       "GOE     0     0     0     0     0    0     0     0     0     0  ...     0   \n",
       "MS      0     0     0     0     0    0     0     0     0     0  ...     0   \n",
       "MM      0     0     0     0     0    0     0     0     0     0  ...     0   \n",
       "ME      0     0     0     0     0    0     0     0     0     0  ...     0   \n",
       "NS      0     0     5     0     0    5     0     0    14     0  ...     0   \n",
       "NM      0     0     0     0     0    0     0     0     0     0  ...     0   \n",
       "NE      0     0     0     0     0    0     0     0     0     0  ...     0   \n",
       "OS      0     0     4     0     0    0     0     0     7     0  ...     0   \n",
       "OM      0     0     0     0     0    0     0     0     0     0  ...  2222   \n",
       "OE      0     0     0     0     0    0     0     0     0     0  ...   988   \n",
       "PS      0     0    46     0     0   65     0     0   257     0  ...     0   \n",
       "PM      0     0     0     0     0    0     0     0     0     0  ...     0   \n",
       "PE      0     0     0     0     0    0     0     0     0     0  ...     0   \n",
       "SS      0     0     8     0     0    0     0     0     0     0  ...     0   \n",
       "SM      0     0     0     0     0    0     0     0     0     0  ...     0   \n",
       "SE      0     0     0     0     0    0     0     0     0     0  ...     0   \n",
       "E       0     0  2700     0     0  904     0     0  2615     0  ...     0   \n",
       "\n",
       "       OM    OE    PS    PM    PE    SS    SM    SE       E  \n",
       "ADS     0     7     0     0     0     0     0     5    2498  \n",
       "ADM     0     0     0     0     0     0     0     0       0  \n",
       "ADE     0     0     0     0     0     0     0     0       2  \n",
       "BS      0     0     0     0     4     0     0     0     777  \n",
       "BM      0     0     0     0     0     0     0     0       0  \n",
       "BE      0     0     0     0     0     0     0     0       0  \n",
       "CS      0     2     0     0    10     0     0     0    2265  \n",
       "CM      0     0     0     0     0     0     0     0       0  \n",
       "CE      0     0     0     0     0     0     0     0      17  \n",
       "GS      0     8     0     0     0     0     0     0    1908  \n",
       "GM      0     0     0     0     0     0     0     0       0  \n",
       "GE      0     0     0     0     0     0     0     0       0  \n",
       "GOS     0     1     0     0     0     0     0     0    1475  \n",
       "GOM     0     0     0     0     0     0     0     0       0  \n",
       "GOE     0     0     0     0     0     0     0     0       0  \n",
       "MS      0     0     0     0     1     0     0     0     890  \n",
       "MM      0     0     0     0     0     0     0     0       0  \n",
       "ME      0     0     0     0     0     0     0     0       0  \n",
       "NS      0     9     0     0  1000     0     0     0    2010  \n",
       "NM      0     0     0     0     0     0     0     0       0  \n",
       "NE      0     0     0     0     0     0     0     0       2  \n",
       "OS      0    45     0     0     0     0     0     0    2685  \n",
       "OM   3627     0     0     0     0     0     0     0       0  \n",
       "OE   2222     0     0     0     0     0     0     0       0  \n",
       "PS      0   160     0     0    13     0     0     8    1983  \n",
       "PM      0     0  1391  1184     0     0     0     0       0  \n",
       "PE      0     0  1749  1391     0     0     0     0       1  \n",
       "SS      0     0     0     0     0     0     0    47    1269  \n",
       "SM      0     0     0     0     0  1325  2379     0       0  \n",
       "SE      0     0     0     0     0   196  1325     0       0  \n",
       "E       0  2899     0     0  2087     0     0  1438  266917  \n",
       "\n",
       "[31 rows x 31 columns]"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "transform_mat = pd.DataFrame(transform_mat).fillna(0)\n",
    "transform_mat"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>浙</th>\n",
       "      <th>商</th>\n",
       "      <th>银</th>\n",
       "      <th>行</th>\n",
       "      <th>企</th>\n",
       "      <th>业</th>\n",
       "      <th>信</th>\n",
       "      <th>贷</th>\n",
       "      <th>部</th>\n",
       "      <th>叶</th>\n",
       "      <th>...</th>\n",
       "      <th>肢</th>\n",
       "      <th>『</th>\n",
       "      <th>』</th>\n",
       "      <th>珑</th>\n",
       "      <th>笃</th>\n",
       "      <th>闺</th>\n",
       "      <th>哗</th>\n",
       "      <th>娥</th>\n",
       "      <th>骞</th>\n",
       "      <th>痞</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>ADS</th>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>ADM</th>\n",
       "      <td>0</td>\n",
       "      <td>48</td>\n",
       "      <td>4</td>\n",
       "      <td>18</td>\n",
       "      <td>4</td>\n",
       "      <td>26</td>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "      <td>21</td>\n",
       "      <td>1</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>ADE</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>15</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>BS</th>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>7</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>BM</th>\n",
       "      <td>0</td>\n",
       "      <td>9</td>\n",
       "      <td>11</td>\n",
       "      <td>28</td>\n",
       "      <td>3</td>\n",
       "      <td>18</td>\n",
       "      <td>11</td>\n",
       "      <td>9</td>\n",
       "      <td>14</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>BE</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>CS</th>\n",
       "      <td>3</td>\n",
       "      <td>11</td>\n",
       "      <td>31</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>CM</th>\n",
       "      <td>3</td>\n",
       "      <td>144</td>\n",
       "      <td>616</td>\n",
       "      <td>161</td>\n",
       "      <td>5</td>\n",
       "      <td>111</td>\n",
       "      <td>119</td>\n",
       "      <td>12</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>CE</th>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>8</td>\n",
       "      <td>880</td>\n",
       "      <td>0</td>\n",
       "      <td>15</td>\n",
       "      <td>14</td>\n",
       "      <td>3</td>\n",
       "      <td>32</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>GS</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>GM</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>11</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>16</td>\n",
       "      <td>0</td>\n",
       "      <td>30</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>GE</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>GOS</th>\n",
       "      <td>3</td>\n",
       "      <td>4</td>\n",
       "      <td>50</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>10</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>GOM</th>\n",
       "      <td>0</td>\n",
       "      <td>14</td>\n",
       "      <td>45</td>\n",
       "      <td>24</td>\n",
       "      <td>1</td>\n",
       "      <td>19</td>\n",
       "      <td>8</td>\n",
       "      <td>1</td>\n",
       "      <td>108</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>GOE</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>132</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>160</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>MS</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>MM</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>14</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>ME</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>NS</th>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>14</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>NM</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>NE</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>OS</th>\n",
       "      <td>1</td>\n",
       "      <td>7</td>\n",
       "      <td>16</td>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>OM</th>\n",
       "      <td>0</td>\n",
       "      <td>20</td>\n",
       "      <td>21</td>\n",
       "      <td>43</td>\n",
       "      <td>1</td>\n",
       "      <td>64</td>\n",
       "      <td>12</td>\n",
       "      <td>2</td>\n",
       "      <td>9</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>OE</th>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>32</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>PS</th>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>6</td>\n",
       "      <td>21</td>\n",
       "      <td>0</td>\n",
       "      <td>14</td>\n",
       "      <td>6</td>\n",
       "      <td>0</td>\n",
       "      <td>10</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>PM</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>55</td>\n",
       "      <td>1</td>\n",
       "      <td>27</td>\n",
       "      <td>1</td>\n",
       "      <td>4</td>\n",
       "      <td>34</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>PE</th>\n",
       "      <td>0</td>\n",
       "      <td>17</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>SS</th>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>SM</th>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>6</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>SE</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>E</th>\n",
       "      <td>2</td>\n",
       "      <td>277</td>\n",
       "      <td>545</td>\n",
       "      <td>1366</td>\n",
       "      <td>100</td>\n",
       "      <td>579</td>\n",
       "      <td>579</td>\n",
       "      <td>294</td>\n",
       "      <td>503</td>\n",
       "      <td>11</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>31 rows × 3671 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "     浙    商    银     行    企    业    信    贷    部   叶  ...  肢  『  』  珑  笃  闺  哗  \\\n",
       "ADS  5    0    5     0    0    0    0    0    0   0  ...  0  0  0  0  0  0  0   \n",
       "ADM  0   48    4    18    4   26    4    0   21   1  ...  0  0  0  0  0  0  0   \n",
       "ADE  0    0    0     1    0    0    0    0   15   0  ...  0  0  0  0  0  0  0   \n",
       "BS   0    2    0     0    1    0    7    0    0   0  ...  0  0  0  0  0  0  0   \n",
       "BM   0    9   11    28    3   18   11    9   14   0  ...  0  0  0  0  0  0  0   \n",
       "BE   0    0    0     1    0    1    0    0    1   0  ...  0  0  0  0  0  0  0   \n",
       "CS   3   11   31     0    0    0    3    0    0   0  ...  0  0  0  0  0  0  0   \n",
       "CM   3  144  616   161    5  111  119   12    2   0  ...  0  0  0  0  0  0  0   \n",
       "CE   0    1    8   880    0   15   14    3   32   0  ...  0  0  0  0  0  0  0   \n",
       "GS   0    0    0     0    0    0    0    0    0   0  ...  0  0  0  0  0  0  0   \n",
       "GM   0    0    2    11    0    0   16    0   30   0  ...  0  0  0  0  0  0  0   \n",
       "GE   0    0    0     1    0    0    0    0    1   0  ...  0  0  0  0  0  0  0   \n",
       "GOS  3    4   50     0    0    1    1    0   10   0  ...  0  0  0  0  0  0  0   \n",
       "GOM  0   14   45    24    1   19    8    1  108   0  ...  0  0  0  0  0  0  0   \n",
       "GOE  0    0    0   132    1    0    0    0  160   0  ...  0  0  0  0  0  0  0   \n",
       "MS   0    0    1     0    0    0    0    0    0   2  ...  0  0  0  0  0  0  0   \n",
       "MM   0    0    2    14    0    0    3    0    1   2  ...  0  0  0  0  0  0  0   \n",
       "ME   0    0    0     0    0    0    0    0    0   0  ...  0  0  0  0  0  0  0   \n",
       "NS   0    1    0     0    0    0    1    0    0  14  ...  0  0  0  0  0  0  0   \n",
       "NM   0    0    1     1    0    0    3    0    0   1  ...  0  0  0  0  0  0  0   \n",
       "NE   0    0    0     1    0    1    2    0    0   1  ...  0  0  0  0  0  0  0   \n",
       "OS   1    7   16     4    0    0    4    0    0   0  ...  0  0  0  0  0  0  0   \n",
       "OM   0   20   21    43    1   64   12    2    9   0  ...  0  0  0  0  0  0  0   \n",
       "OE   0    1    0     0    0    2    0    0   32   0  ...  0  0  0  0  0  0  0   \n",
       "PS   0    1    6    21    0   14    6    0   10   0  ...  0  0  0  0  0  0  0   \n",
       "PM   0    0    2    55    1   27    1    4   34   0  ...  0  0  0  0  0  0  0   \n",
       "PE   0   17    0     0    0    0    0    0    3   0  ...  0  0  0  0  0  0  0   \n",
       "SS   2    0    1     0    1    0    0    0    0   0  ...  0  0  0  0  0  0  0   \n",
       "SM   0    1    3     6    1    1    2    0    0   0  ...  0  0  0  0  0  0  0   \n",
       "SE   0    0    0     0    0    0    0    0    1   0  ...  0  0  0  0  0  0  0   \n",
       "E    2  277  545  1366  100  579  579  294  503  11  ...  0  0  0  0  0  0  0   \n",
       "\n",
       "     娥  骞  痞  \n",
       "ADS  0  0  0  \n",
       "ADM  0  0  0  \n",
       "ADE  0  0  0  \n",
       "BS   0  0  0  \n",
       "BM   0  0  0  \n",
       "BE   0  0  0  \n",
       "CS   0  0  0  \n",
       "CM   0  0  0  \n",
       "CE   0  0  0  \n",
       "GS   0  0  0  \n",
       "GM   0  0  0  \n",
       "GE   0  0  0  \n",
       "GOS  0  0  0  \n",
       "GOM  0  0  0  \n",
       "GOE  0  0  0  \n",
       "MS   0  0  0  \n",
       "MM   0  0  0  \n",
       "ME   0  0  0  \n",
       "NS   0  0  0  \n",
       "NM   0  0  0  \n",
       "NE   0  0  0  \n",
       "OS   0  0  0  \n",
       "OM   0  0  0  \n",
       "OE   0  0  0  \n",
       "PS   0  0  0  \n",
       "PM   0  0  0  \n",
       "PE   0  0  0  \n",
       "SS   0  0  0  \n",
       "SM   0  0  0  \n",
       "SE   0  0  0  \n",
       "E    0  0  0  \n",
       "\n",
       "[31 rows x 3671 columns]"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "singleword_mat = pd.DataFrame(singleword_mat).fillna(0)\n",
    "singleword_mat"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "由于需要的是概率矩阵，我们将其归一化"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "init_mat = init_mat.div(init_mat.sum(axis=1),axis='rows').fillna(0)\n",
    "transform_mat = transform_mat.div(transform_mat.sum(axis=0),axis='columns').fillna(0)\n",
    "singleword_mat = singleword_mat.div(singleword_mat.sum(axis=1),axis='rows').fillna(0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>ADS</th>\n",
       "      <th>ADM</th>\n",
       "      <th>ADE</th>\n",
       "      <th>BS</th>\n",
       "      <th>BM</th>\n",
       "      <th>BE</th>\n",
       "      <th>CS</th>\n",
       "      <th>CM</th>\n",
       "      <th>CE</th>\n",
       "      <th>GS</th>\n",
       "      <th>...</th>\n",
       "      <th>OS</th>\n",
       "      <th>OM</th>\n",
       "      <th>OE</th>\n",
       "      <th>PS</th>\n",
       "      <th>PM</th>\n",
       "      <th>PE</th>\n",
       "      <th>SS</th>\n",
       "      <th>SM</th>\n",
       "      <th>SE</th>\n",
       "      <th>E</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>init</th>\n",
       "      <td>0.029587</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.024563</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0615</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.037774</td>\n",
       "      <td>...</td>\n",
       "      <td>0.042054</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.022702</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.018329</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.652959</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>1 rows × 31 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "           ADS  ADM  ADE        BS   BM   BE      CS   CM   CE        GS  ...  \\\n",
       "init  0.029587  0.0  0.0  0.024563  0.0  0.0  0.0615  0.0  0.0  0.037774  ...   \n",
       "\n",
       "            OS   OM   OE        PS   PM   PE        SS   SM   SE         E  \n",
       "init  0.042054  0.0  0.0  0.022702  0.0  0.0  0.018329  0.0  0.0  0.652959  \n",
       "\n",
       "[1 rows x 31 columns]"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "init_mat"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>ADS</th>\n",
       "      <th>ADM</th>\n",
       "      <th>ADE</th>\n",
       "      <th>BS</th>\n",
       "      <th>BM</th>\n",
       "      <th>BE</th>\n",
       "      <th>CS</th>\n",
       "      <th>CM</th>\n",
       "      <th>CE</th>\n",
       "      <th>GS</th>\n",
       "      <th>...</th>\n",
       "      <th>OS</th>\n",
       "      <th>OM</th>\n",
       "      <th>OE</th>\n",
       "      <th>PS</th>\n",
       "      <th>PM</th>\n",
       "      <th>PE</th>\n",
       "      <th>SS</th>\n",
       "      <th>SM</th>\n",
       "      <th>SE</th>\n",
       "      <th>E</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>ADS</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.006783</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.003846</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.007138</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.002236</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.003338</td>\n",
       "      <td>0.008774</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>ADM</th>\n",
       "      <td>0.66009</td>\n",
       "      <td>0.771726</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>ADE</th>\n",
       "      <td>0.33991</td>\n",
       "      <td>0.228274</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000007</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>BS</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.001785</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.059615</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.001284</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.002729</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>BM</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.965759</td>\n",
       "      <td>0.799782</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000680</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>BE</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.033363</td>\n",
       "      <td>0.200036</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>CS</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.003927</td>\n",
       "      <td>0.000878</td>\n",
       "      <td>0.000182</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.003739</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000639</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.003210</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.007956</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>CM</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.733378</td>\n",
       "      <td>0.725389</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>CE</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.266622</td>\n",
       "      <td>0.274611</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000060</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>GS</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.001071</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.005099</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.002555</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.006702</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>GM</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.934343</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>GE</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.065657</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>GOS</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000319</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.005181</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>GOM</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>GOE</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>MS</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000321</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.003126</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>MM</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>ME</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>NS</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.001785</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.004808</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.004759</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.002874</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.321027</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.007060</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>NM</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>NE</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000007</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>OS</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.001428</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.002379</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.014372</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.009431</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>OM</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.692212</td>\n",
       "      <td>0.620106</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>OE</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.307788</td>\n",
       "      <td>0.379894</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>PS</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.016423</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.062500</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.087356</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.051102</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.004173</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.005340</td>\n",
       "      <td>0.006965</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>PM</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.442994</td>\n",
       "      <td>0.459806</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>PE</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.557006</td>\n",
       "      <td>0.540194</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000004</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>SS</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.002856</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.031375</td>\n",
       "      <td>0.004457</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>SM</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.871137</td>\n",
       "      <td>0.642279</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>SE</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.128863</td>\n",
       "      <td>0.357721</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>E</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.963941</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.869231</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.888851</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.925902</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.669984</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.959947</td>\n",
       "      <td>0.937541</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>31 rows × 31 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "         ADS       ADM       ADE        BS        BM        BE        CS  \\\n",
       "ADS  0.00000  0.000000  0.006783  0.000000  0.000000  0.003846  0.000000   \n",
       "ADM  0.66009  0.771726  0.000000  0.000000  0.000000  0.000000  0.000000   \n",
       "ADE  0.33991  0.228274  0.000000  0.000000  0.000000  0.000000  0.000000   \n",
       "BS   0.00000  0.000000  0.001785  0.000000  0.000000  0.059615  0.000000   \n",
       "BM   0.00000  0.000000  0.000000  0.965759  0.799782  0.000000  0.000000   \n",
       "BE   0.00000  0.000000  0.000000  0.033363  0.200036  0.000000  0.000000   \n",
       "CS   0.00000  0.000000  0.003927  0.000878  0.000182  0.000000  0.000000   \n",
       "CM   0.00000  0.000000  0.000000  0.000000  0.000000  0.000000  0.733378   \n",
       "CE   0.00000  0.000000  0.000000  0.000000  0.000000  0.000000  0.266622   \n",
       "GS   0.00000  0.000000  0.001071  0.000000  0.000000  0.000000  0.000000   \n",
       "GM   0.00000  0.000000  0.000000  0.000000  0.000000  0.000000  0.000000   \n",
       "GE   0.00000  0.000000  0.000000  0.000000  0.000000  0.000000  0.000000   \n",
       "GOS  0.00000  0.000000  0.000000  0.000000  0.000000  0.000000  0.000000   \n",
       "GOM  0.00000  0.000000  0.000000  0.000000  0.000000  0.000000  0.000000   \n",
       "GOE  0.00000  0.000000  0.000000  0.000000  0.000000  0.000000  0.000000   \n",
       "MS   0.00000  0.000000  0.000000  0.000000  0.000000  0.000000  0.000000   \n",
       "MM   0.00000  0.000000  0.000000  0.000000  0.000000  0.000000  0.000000   \n",
       "ME   0.00000  0.000000  0.000000  0.000000  0.000000  0.000000  0.000000   \n",
       "NS   0.00000  0.000000  0.001785  0.000000  0.000000  0.004808  0.000000   \n",
       "NM   0.00000  0.000000  0.000000  0.000000  0.000000  0.000000  0.000000   \n",
       "NE   0.00000  0.000000  0.000000  0.000000  0.000000  0.000000  0.000000   \n",
       "OS   0.00000  0.000000  0.001428  0.000000  0.000000  0.000000  0.000000   \n",
       "OM   0.00000  0.000000  0.000000  0.000000  0.000000  0.000000  0.000000   \n",
       "OE   0.00000  0.000000  0.000000  0.000000  0.000000  0.000000  0.000000   \n",
       "PS   0.00000  0.000000  0.016423  0.000000  0.000000  0.062500  0.000000   \n",
       "PM   0.00000  0.000000  0.000000  0.000000  0.000000  0.000000  0.000000   \n",
       "PE   0.00000  0.000000  0.000000  0.000000  0.000000  0.000000  0.000000   \n",
       "SS   0.00000  0.000000  0.002856  0.000000  0.000000  0.000000  0.000000   \n",
       "SM   0.00000  0.000000  0.000000  0.000000  0.000000  0.000000  0.000000   \n",
       "SE   0.00000  0.000000  0.000000  0.000000  0.000000  0.000000  0.000000   \n",
       "E    0.00000  0.000000  0.963941  0.000000  0.000000  0.869231  0.000000   \n",
       "\n",
       "           CM        CE        GS  ...        OS        OM        OE  \\\n",
       "ADS  0.000000  0.007138  0.000000  ...  0.000000  0.000000  0.002236   \n",
       "ADM  0.000000  0.000000  0.000000  ...  0.000000  0.000000  0.000000   \n",
       "ADE  0.000000  0.000000  0.000000  ...  0.000000  0.000000  0.000000   \n",
       "BS   0.000000  0.000000  0.000000  ...  0.000000  0.000000  0.000000   \n",
       "BM   0.000000  0.000680  0.000000  ...  0.000000  0.000000  0.000000   \n",
       "BE   0.000000  0.000000  0.000000  ...  0.000000  0.000000  0.000000   \n",
       "CS   0.000000  0.003739  0.000000  ...  0.000000  0.000000  0.000639   \n",
       "CM   0.725389  0.000000  0.000000  ...  0.000000  0.000000  0.000000   \n",
       "CE   0.274611  0.000000  0.000000  ...  0.000000  0.000000  0.000000   \n",
       "GS   0.000000  0.005099  0.000000  ...  0.000000  0.000000  0.002555   \n",
       "GM   0.000000  0.000000  0.934343  ...  0.000000  0.000000  0.000000   \n",
       "GE   0.000000  0.000000  0.065657  ...  0.000000  0.000000  0.000000   \n",
       "GOS  0.000000  0.000000  0.000000  ...  0.000000  0.000000  0.000319   \n",
       "GOM  0.000000  0.000000  0.000000  ...  0.000000  0.000000  0.000000   \n",
       "GOE  0.000000  0.000000  0.000000  ...  0.000000  0.000000  0.000000   \n",
       "MS   0.000000  0.000000  0.000000  ...  0.000000  0.000000  0.000000   \n",
       "MM   0.000000  0.000000  0.000000  ...  0.000000  0.000000  0.000000   \n",
       "ME   0.000000  0.000000  0.000000  ...  0.000000  0.000000  0.000000   \n",
       "NS   0.000000  0.004759  0.000000  ...  0.000000  0.000000  0.002874   \n",
       "NM   0.000000  0.000000  0.000000  ...  0.000000  0.000000  0.000000   \n",
       "NE   0.000000  0.000000  0.000000  ...  0.000000  0.000000  0.000000   \n",
       "OS   0.000000  0.002379  0.000000  ...  0.000000  0.000000  0.014372   \n",
       "OM   0.000000  0.000000  0.000000  ...  0.692212  0.620106  0.000000   \n",
       "OE   0.000000  0.000000  0.000000  ...  0.307788  0.379894  0.000000   \n",
       "PS   0.000000  0.087356  0.000000  ...  0.000000  0.000000  0.051102   \n",
       "PM   0.000000  0.000000  0.000000  ...  0.000000  0.000000  0.000000   \n",
       "PE   0.000000  0.000000  0.000000  ...  0.000000  0.000000  0.000000   \n",
       "SS   0.000000  0.000000  0.000000  ...  0.000000  0.000000  0.000000   \n",
       "SM   0.000000  0.000000  0.000000  ...  0.000000  0.000000  0.000000   \n",
       "SE   0.000000  0.000000  0.000000  ...  0.000000  0.000000  0.000000   \n",
       "E    0.000000  0.888851  0.000000  ...  0.000000  0.000000  0.925902   \n",
       "\n",
       "           PS        PM        PE        SS        SM        SE         E  \n",
       "ADS  0.000000  0.000000  0.000000  0.000000  0.000000  0.003338  0.008774  \n",
       "ADM  0.000000  0.000000  0.000000  0.000000  0.000000  0.000000  0.000000  \n",
       "ADE  0.000000  0.000000  0.000000  0.000000  0.000000  0.000000  0.000007  \n",
       "BS   0.000000  0.000000  0.001284  0.000000  0.000000  0.000000  0.002729  \n",
       "BM   0.000000  0.000000  0.000000  0.000000  0.000000  0.000000  0.000000  \n",
       "BE   0.000000  0.000000  0.000000  0.000000  0.000000  0.000000  0.000000  \n",
       "CS   0.000000  0.000000  0.003210  0.000000  0.000000  0.000000  0.007956  \n",
       "CM   0.000000  0.000000  0.000000  0.000000  0.000000  0.000000  0.000000  \n",
       "CE   0.000000  0.000000  0.000000  0.000000  0.000000  0.000000  0.000060  \n",
       "GS   0.000000  0.000000  0.000000  0.000000  0.000000  0.000000  0.006702  \n",
       "GM   0.000000  0.000000  0.000000  0.000000  0.000000  0.000000  0.000000  \n",
       "GE   0.000000  0.000000  0.000000  0.000000  0.000000  0.000000  0.000000  \n",
       "GOS  0.000000  0.000000  0.000000  0.000000  0.000000  0.000000  0.005181  \n",
       "GOM  0.000000  0.000000  0.000000  0.000000  0.000000  0.000000  0.000000  \n",
       "GOE  0.000000  0.000000  0.000000  0.000000  0.000000  0.000000  0.000000  \n",
       "MS   0.000000  0.000000  0.000321  0.000000  0.000000  0.000000  0.003126  \n",
       "MM   0.000000  0.000000  0.000000  0.000000  0.000000  0.000000  0.000000  \n",
       "ME   0.000000  0.000000  0.000000  0.000000  0.000000  0.000000  0.000000  \n",
       "NS   0.000000  0.000000  0.321027  0.000000  0.000000  0.000000  0.007060  \n",
       "NM   0.000000  0.000000  0.000000  0.000000  0.000000  0.000000  0.000000  \n",
       "NE   0.000000  0.000000  0.000000  0.000000  0.000000  0.000000  0.000007  \n",
       "OS   0.000000  0.000000  0.000000  0.000000  0.000000  0.000000  0.009431  \n",
       "OM   0.000000  0.000000  0.000000  0.000000  0.000000  0.000000  0.000000  \n",
       "OE   0.000000  0.000000  0.000000  0.000000  0.000000  0.000000  0.000000  \n",
       "PS   0.000000  0.000000  0.004173  0.000000  0.000000  0.005340  0.006965  \n",
       "PM   0.442994  0.459806  0.000000  0.000000  0.000000  0.000000  0.000000  \n",
       "PE   0.557006  0.540194  0.000000  0.000000  0.000000  0.000000  0.000004  \n",
       "SS   0.000000  0.000000  0.000000  0.000000  0.000000  0.031375  0.004457  \n",
       "SM   0.000000  0.000000  0.000000  0.871137  0.642279  0.000000  0.000000  \n",
       "SE   0.000000  0.000000  0.000000  0.128863  0.357721  0.000000  0.000000  \n",
       "E    0.000000  0.000000  0.669984  0.000000  0.000000  0.959947  0.937541  \n",
       "\n",
       "[31 rows x 31 columns]"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "transform_mat"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>浙</th>\n",
       "      <th>商</th>\n",
       "      <th>银</th>\n",
       "      <th>行</th>\n",
       "      <th>企</th>\n",
       "      <th>业</th>\n",
       "      <th>信</th>\n",
       "      <th>贷</th>\n",
       "      <th>部</th>\n",
       "      <th>叶</th>\n",
       "      <th>...</th>\n",
       "      <th>肢</th>\n",
       "      <th>『</th>\n",
       "      <th>』</th>\n",
       "      <th>珑</th>\n",
       "      <th>笃</th>\n",
       "      <th>闺</th>\n",
       "      <th>哗</th>\n",
       "      <th>娥</th>\n",
       "      <th>骞</th>\n",
       "      <th>痞</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>ADS</th>\n",
       "      <td>0.001760</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.001760</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>ADM</th>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.005813</td>\n",
       "      <td>0.000484</td>\n",
       "      <td>0.002180</td>\n",
       "      <td>0.000484</td>\n",
       "      <td>0.003148</td>\n",
       "      <td>0.000484</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.002543</td>\n",
       "      <td>0.000121</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>ADE</th>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000351</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.005258</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>BS</th>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.001770</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000885</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.006195</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>BM</th>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.001665</td>\n",
       "      <td>0.002035</td>\n",
       "      <td>0.005180</td>\n",
       "      <td>0.000555</td>\n",
       "      <td>0.003330</td>\n",
       "      <td>0.002035</td>\n",
       "      <td>0.001665</td>\n",
       "      <td>0.002590</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>BE</th>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000883</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000883</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000883</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>CS</th>\n",
       "      <td>0.001021</td>\n",
       "      <td>0.003743</td>\n",
       "      <td>0.010548</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.001021</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>CM</th>\n",
       "      <td>0.000382</td>\n",
       "      <td>0.018316</td>\n",
       "      <td>0.078352</td>\n",
       "      <td>0.020478</td>\n",
       "      <td>0.000636</td>\n",
       "      <td>0.014119</td>\n",
       "      <td>0.015136</td>\n",
       "      <td>0.001526</td>\n",
       "      <td>0.000254</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>CE</th>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000337</td>\n",
       "      <td>0.002695</td>\n",
       "      <td>0.296496</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.005054</td>\n",
       "      <td>0.004717</td>\n",
       "      <td>0.001011</td>\n",
       "      <td>0.010782</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>GS</th>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>GM</th>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000230</td>\n",
       "      <td>0.001267</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.001844</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.003457</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>GE</th>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000421</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000421</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>GOS</th>\n",
       "      <td>0.001645</td>\n",
       "      <td>0.002193</td>\n",
       "      <td>0.027412</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000548</td>\n",
       "      <td>0.000548</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.005482</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>GOM</th>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.002501</td>\n",
       "      <td>0.008040</td>\n",
       "      <td>0.004288</td>\n",
       "      <td>0.000179</td>\n",
       "      <td>0.003395</td>\n",
       "      <td>0.001429</td>\n",
       "      <td>0.000179</td>\n",
       "      <td>0.019296</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>GOE</th>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.072171</td>\n",
       "      <td>0.000547</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.087479</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>MS</th>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000895</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.001791</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>MM</th>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000366</td>\n",
       "      <td>0.002563</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000549</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000183</td>\n",
       "      <td>0.000366</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>ME</th>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>NS</th>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000274</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000274</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.003837</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>NM</th>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000187</td>\n",
       "      <td>0.000187</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000562</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000187</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>NE</th>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000277</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000277</td>\n",
       "      <td>0.000554</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000277</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>OS</th>\n",
       "      <td>0.000315</td>\n",
       "      <td>0.002202</td>\n",
       "      <td>0.005033</td>\n",
       "      <td>0.001258</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.001258</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>OM</th>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.003456</td>\n",
       "      <td>0.003629</td>\n",
       "      <td>0.007430</td>\n",
       "      <td>0.000173</td>\n",
       "      <td>0.011059</td>\n",
       "      <td>0.002074</td>\n",
       "      <td>0.000346</td>\n",
       "      <td>0.001555</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>OE</th>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000314</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000629</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.010063</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>PS</th>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000320</td>\n",
       "      <td>0.001919</td>\n",
       "      <td>0.006716</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.004477</td>\n",
       "      <td>0.001919</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.003198</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>PM</th>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000782</td>\n",
       "      <td>0.021510</td>\n",
       "      <td>0.000391</td>\n",
       "      <td>0.010559</td>\n",
       "      <td>0.000391</td>\n",
       "      <td>0.001564</td>\n",
       "      <td>0.013297</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>PE</th>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.005433</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000959</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>SS</th>\n",
       "      <td>0.001349</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000674</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000674</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>SM</th>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000275</td>\n",
       "      <td>0.000825</td>\n",
       "      <td>0.001651</td>\n",
       "      <td>0.000275</td>\n",
       "      <td>0.000275</td>\n",
       "      <td>0.000550</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>SE</th>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000666</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>E</th>\n",
       "      <td>0.000007</td>\n",
       "      <td>0.000948</td>\n",
       "      <td>0.001865</td>\n",
       "      <td>0.004676</td>\n",
       "      <td>0.000342</td>\n",
       "      <td>0.001982</td>\n",
       "      <td>0.001982</td>\n",
       "      <td>0.001006</td>\n",
       "      <td>0.001722</td>\n",
       "      <td>0.000038</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>31 rows × 3671 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "            浙         商         银         行         企         业         信  \\\n",
       "ADS  0.001760  0.000000  0.001760  0.000000  0.000000  0.000000  0.000000   \n",
       "ADM  0.000000  0.005813  0.000484  0.002180  0.000484  0.003148  0.000484   \n",
       "ADE  0.000000  0.000000  0.000000  0.000351  0.000000  0.000000  0.000000   \n",
       "BS   0.000000  0.001770  0.000000  0.000000  0.000885  0.000000  0.006195   \n",
       "BM   0.000000  0.001665  0.002035  0.005180  0.000555  0.003330  0.002035   \n",
       "BE   0.000000  0.000000  0.000000  0.000883  0.000000  0.000883  0.000000   \n",
       "CS   0.001021  0.003743  0.010548  0.000000  0.000000  0.000000  0.001021   \n",
       "CM   0.000382  0.018316  0.078352  0.020478  0.000636  0.014119  0.015136   \n",
       "CE   0.000000  0.000337  0.002695  0.296496  0.000000  0.005054  0.004717   \n",
       "GS   0.000000  0.000000  0.000000  0.000000  0.000000  0.000000  0.000000   \n",
       "GM   0.000000  0.000000  0.000230  0.001267  0.000000  0.000000  0.001844   \n",
       "GE   0.000000  0.000000  0.000000  0.000421  0.000000  0.000000  0.000000   \n",
       "GOS  0.001645  0.002193  0.027412  0.000000  0.000000  0.000548  0.000548   \n",
       "GOM  0.000000  0.002501  0.008040  0.004288  0.000179  0.003395  0.001429   \n",
       "GOE  0.000000  0.000000  0.000000  0.072171  0.000547  0.000000  0.000000   \n",
       "MS   0.000000  0.000000  0.000895  0.000000  0.000000  0.000000  0.000000   \n",
       "MM   0.000000  0.000000  0.000366  0.002563  0.000000  0.000000  0.000549   \n",
       "ME   0.000000  0.000000  0.000000  0.000000  0.000000  0.000000  0.000000   \n",
       "NS   0.000000  0.000274  0.000000  0.000000  0.000000  0.000000  0.000274   \n",
       "NM   0.000000  0.000000  0.000187  0.000187  0.000000  0.000000  0.000562   \n",
       "NE   0.000000  0.000000  0.000000  0.000277  0.000000  0.000277  0.000554   \n",
       "OS   0.000315  0.002202  0.005033  0.001258  0.000000  0.000000  0.001258   \n",
       "OM   0.000000  0.003456  0.003629  0.007430  0.000173  0.011059  0.002074   \n",
       "OE   0.000000  0.000314  0.000000  0.000000  0.000000  0.000629  0.000000   \n",
       "PS   0.000000  0.000320  0.001919  0.006716  0.000000  0.004477  0.001919   \n",
       "PM   0.000000  0.000000  0.000782  0.021510  0.000391  0.010559  0.000391   \n",
       "PE   0.000000  0.005433  0.000000  0.000000  0.000000  0.000000  0.000000   \n",
       "SS   0.001349  0.000000  0.000674  0.000000  0.000674  0.000000  0.000000   \n",
       "SM   0.000000  0.000275  0.000825  0.001651  0.000275  0.000275  0.000550   \n",
       "SE   0.000000  0.000000  0.000000  0.000000  0.000000  0.000000  0.000000   \n",
       "E    0.000007  0.000948  0.001865  0.004676  0.000342  0.001982  0.001982   \n",
       "\n",
       "            贷         部         叶  ...    肢    『    』    珑    笃    闺    哗  \\\n",
       "ADS  0.000000  0.000000  0.000000  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0   \n",
       "ADM  0.000000  0.002543  0.000121  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0   \n",
       "ADE  0.000000  0.005258  0.000000  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0   \n",
       "BS   0.000000  0.000000  0.000000  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0   \n",
       "BM   0.001665  0.002590  0.000000  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0   \n",
       "BE   0.000000  0.000883  0.000000  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0   \n",
       "CS   0.000000  0.000000  0.000000  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0   \n",
       "CM   0.001526  0.000254  0.000000  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0   \n",
       "CE   0.001011  0.010782  0.000000  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0   \n",
       "GS   0.000000  0.000000  0.000000  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0   \n",
       "GM   0.000000  0.003457  0.000000  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0   \n",
       "GE   0.000000  0.000421  0.000000  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0   \n",
       "GOS  0.000000  0.005482  0.000000  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0   \n",
       "GOM  0.000179  0.019296  0.000000  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0   \n",
       "GOE  0.000000  0.087479  0.000000  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0   \n",
       "MS   0.000000  0.000000  0.001791  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0   \n",
       "MM   0.000000  0.000183  0.000366  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0   \n",
       "ME   0.000000  0.000000  0.000000  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0   \n",
       "NS   0.000000  0.000000  0.003837  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0   \n",
       "NM   0.000000  0.000000  0.000187  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0   \n",
       "NE   0.000000  0.000000  0.000277  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0   \n",
       "OS   0.000000  0.000000  0.000000  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0   \n",
       "OM   0.000346  0.001555  0.000000  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0   \n",
       "OE   0.000000  0.010063  0.000000  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0   \n",
       "PS   0.000000  0.003198  0.000000  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0   \n",
       "PM   0.001564  0.013297  0.000000  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0   \n",
       "PE   0.000000  0.000959  0.000000  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0   \n",
       "SS   0.000000  0.000000  0.000000  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0   \n",
       "SM   0.000000  0.000000  0.000000  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0   \n",
       "SE   0.000000  0.000666  0.000000  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0   \n",
       "E    0.001006  0.001722  0.000038  ...  0.0  0.0  0.0  0.0  0.0  0.0  0.0   \n",
       "\n",
       "       娥    骞    痞  \n",
       "ADS  0.0  0.0  0.0  \n",
       "ADM  0.0  0.0  0.0  \n",
       "ADE  0.0  0.0  0.0  \n",
       "BS   0.0  0.0  0.0  \n",
       "BM   0.0  0.0  0.0  \n",
       "BE   0.0  0.0  0.0  \n",
       "CS   0.0  0.0  0.0  \n",
       "CM   0.0  0.0  0.0  \n",
       "CE   0.0  0.0  0.0  \n",
       "GS   0.0  0.0  0.0  \n",
       "GM   0.0  0.0  0.0  \n",
       "GE   0.0  0.0  0.0  \n",
       "GOS  0.0  0.0  0.0  \n",
       "GOM  0.0  0.0  0.0  \n",
       "GOE  0.0  0.0  0.0  \n",
       "MS   0.0  0.0  0.0  \n",
       "MM   0.0  0.0  0.0  \n",
       "ME   0.0  0.0  0.0  \n",
       "NS   0.0  0.0  0.0  \n",
       "NM   0.0  0.0  0.0  \n",
       "NE   0.0  0.0  0.0  \n",
       "OS   0.0  0.0  0.0  \n",
       "OM   0.0  0.0  0.0  \n",
       "OE   0.0  0.0  0.0  \n",
       "PS   0.0  0.0  0.0  \n",
       "PM   0.0  0.0  0.0  \n",
       "PE   0.0  0.0  0.0  \n",
       "SS   0.0  0.0  0.0  \n",
       "SM   0.0  0.0  0.0  \n",
       "SE   0.0  0.0  0.0  \n",
       "E    0.0  0.0  0.0  \n",
       "\n",
       "[31 rows x 3671 columns]"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "singleword_mat"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "注意，为了避免出现除零错误，要fillna(0)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 算法的封装和计算"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "下面基于维特比算法进行计算"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [],
   "source": [
    "def to_seq(sentence, init_mat, transform_mat, singleword_mat):\n",
    "    nn = {}\n",
    "    seq = []\n",
    "    for i in range(len(sentence)):\n",
    "        if i not in nn:\n",
    "            nn[i]={}\n",
    "        for j in total_label:\n",
    "            if j not in nn[i]:\n",
    "                nn[i][j] = 0\n",
    "    nn = pd.DataFrame(nn,dtype = 'float64')\n",
    "    for j in total_label:\n",
    "        nn[0][j] = init_mat[j]['init']*singleword_mat[sentence[0]][j]\n",
    "    mm = pd.DataFrame(np.zeros((31,len(sentence))),index=total_label,columns = np.arange(len(sentence),dtype = 'int'),dtype='str')\n",
    "    for i in range(1,len(sentence)):\n",
    "        for j in total_label:\n",
    "            maxvalue = 0\n",
    "            for k in total_label:\n",
    "                result = nn[i-1][k]*singleword_mat[sentence[i]][j]*transform_mat[k][j]\n",
    "                if result>maxvalue:\n",
    "                    maxvalue = result\n",
    "                    mm[i][j] = k\n",
    "            nn[i][j] = maxvalue\n",
    "    maxvalue = -1\n",
    "    max_id = ' '\n",
    "    mm = mm.replace('0.0','E')\n",
    "    for j in total_label:\n",
    "        if nn[len(sentence)-1][j]>maxvalue:\n",
    "            maxvalue=nn[len(sentence)-1][j]\n",
    "            maxid = j\n",
    "    seq.append(maxid)\n",
    "    flag = int(len(sentence)-1)\n",
    "    while flag>0.5:\n",
    "        seq.append(mm[flag][maxid])\n",
    "        maxid = mm[flag][maxid]\n",
    "        flag -= 1\n",
    "    seq = seq[::-1]\n",
    "    return seq"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [],
   "source": [
    "sentence = '浙商银行企业信贷部叶老桂博士则从另一个角度对五道门槛进行了解读。叶老桂认为，对目前国内商业银行而言'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['CS',\n",
       " 'CM',\n",
       " 'CM',\n",
       " 'CM',\n",
       " 'CM',\n",
       " 'CM',\n",
       " 'CM',\n",
       " 'CM',\n",
       " 'CE',\n",
       " 'NS',\n",
       " 'NM',\n",
       " 'NM',\n",
       " 'NE',\n",
       " 'E',\n",
       " 'E',\n",
       " 'E',\n",
       " 'E',\n",
       " 'E',\n",
       " 'E',\n",
       " 'E',\n",
       " 'E',\n",
       " 'E',\n",
       " 'E',\n",
       " 'E',\n",
       " 'E',\n",
       " 'E',\n",
       " 'E',\n",
       " 'E',\n",
       " 'E',\n",
       " 'E',\n",
       " 'E',\n",
       " 'E',\n",
       " 'E',\n",
       " 'E',\n",
       " 'E',\n",
       " 'E',\n",
       " 'E',\n",
       " 'E',\n",
       " 'E',\n",
       " 'E',\n",
       " 'E',\n",
       " 'E',\n",
       " 'E',\n",
       " 'CS',\n",
       " 'CM',\n",
       " 'CM',\n",
       " 'CE',\n",
       " 'E',\n",
       " 'E']"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "to_seq(sentence, init_mat, transform_mat, singleword_mat)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [],
   "source": [
    "def cut(sentence,seq):\n",
    "    i = 0\n",
    "    result = {}\n",
    "    while(i<len(seq)):\n",
    "        \n",
    "        if seq[i] == 'ADS':\n",
    "            flag1 = i\n",
    "            while  i+1!=len(sentence) and (seq[i+1]=='ADM' or seq[i+1]=='ADE'):\n",
    "                i+=1\n",
    "            if 'address' not in result:\n",
    "                result['address'] = []\n",
    "            result['address'].append(sentence[flag1:i+1])\n",
    "            \n",
    "        if seq[i] == 'BS':\n",
    "            flag1 = i\n",
    "            while  i+1!=len(sentence) and (seq[i+1]=='BM' or seq[i+1]=='BE'):\n",
    "                i+=1\n",
    "            if 'book' not in result:\n",
    "                result['book'] = []\n",
    "            result['book'].append(sentence[flag1:i+1])\n",
    "            \n",
    "            \n",
    "        if seq[i] == 'CS':\n",
    "            flag1 = i\n",
    "            while i+1!=len(sentence) and (seq[i+1]=='CM' or seq[i+1]=='CE') :\n",
    "                i+=1\n",
    "            if 'company' not in result:\n",
    "                result['company'] = []\n",
    "            result['company'].append(sentence[flag1:i+1])\n",
    "            #print(i)\n",
    "        if seq[i] == 'GS':\n",
    "            flag1 = i\n",
    "            while  i+1!=len(sentence) and (seq[i+1]=='GM' or seq[i+1]=='GE'):\n",
    "                i+=1\n",
    "            if 'game' not in result:\n",
    "                result['game'] = []\n",
    "            result['game'].append(sentence[flag1:i+1])\n",
    "        if seq[i] == 'GOS':\n",
    "            flag1 = i\n",
    "            while i+1!=len(sentence) and (seq[i+1]=='GOM' or seq[i+1]=='GOE'):\n",
    "                i+=1\n",
    "            if 'goverment' not in result:\n",
    "                result['goverment'] = []\n",
    "            result['goverment'].append(sentence[flag1:i+1])\n",
    "        if seq[i] == 'MS':\n",
    "            flag1 = i\n",
    "            while i+1!=len(sentence) and (seq[i+1]=='MM' or seq[i+1]=='ME'):\n",
    "                i+=1\n",
    "            if 'movie' not in result:\n",
    "                result['movie'] = []\n",
    "            result['movie'].append(sentence[flag1:i+1])\n",
    "            \n",
    "        if seq[i] == 'NS':\n",
    "           # print('ddd')\n",
    "            flag1 = i\n",
    "            while i+1!=len(sentence) and (seq[i+1]=='NM' or seq[i+1]=='NE'):\n",
    "                i+=1\n",
    "            if 'name' not in result:\n",
    "                result['name'] = []\n",
    "            result['name'].append(sentence[flag1:i+1])\n",
    "            \n",
    "        if seq[i] == 'OS':\n",
    "            flag1 = i\n",
    "            while i+1!=len(sentence) and (seq[i+1]=='OM' or seq[i+1]=='OE') :\n",
    "                i+=1\n",
    "            if 'organization' not in result:\n",
    "                result['organization'] = []\n",
    "            result['organization'].append(sentence[flag1:i+1])\n",
    "        \n",
    "        if seq[i] == 'PS':\n",
    "            flag1 = i\n",
    "            while i+1!=len(sentence) and (seq[i+1]=='PM' or seq[i+1]=='PE'):\n",
    "                i+=1\n",
    "            if 'position' not in result:\n",
    "                result['position'] = []\n",
    "            result['position'].append(sentence[flag1:i+1])\n",
    "        \n",
    "        if seq[i] == 'SS':\n",
    "            flag1 = i\n",
    "            while i+1!=len(sentence) and (seq[i+1]=='SM' or seq[i+1]=='SE'):\n",
    "                i+=1\n",
    "            if 'scene' not in result:\n",
    "                result['scene'] = []\n",
    "            result['scene'].append(sentence[flag1:i+1])\n",
    "        \n",
    "        i+=1\n",
    "        #print(i)\n",
    "    return result"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [],
   "source": [
    "a = cut(sentence, to_seq(sentence, init_mat, transform_mat, singleword_mat))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'company': ['浙商银行企业信贷部', '商业银行'], 'name': ['叶老桂博']}"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [],
   "source": [
    "with open('dev.json', encoding='utf-8') as f:\n",
    "    dev_data = f.readlines()\n",
    "dev_data = [json.loads(i) for i in dev_data]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [],
   "source": [
    "dev_dataset = []\n",
    "for info in dev_data:\n",
    "    dic = {}\n",
    "    text = info['text'] \n",
    "    tag = ['E' for i in range(len(text))]\n",
    "    for label in info['label']:\n",
    "        for i in info['label'][label]:\n",
    "            for j in info['label'][label][i]:\n",
    "                if label == 'address':\n",
    "                    tag[j[0]] = 'ADS'\n",
    "                    tag[j[1]] = 'ADE'\n",
    "                    for k in range(j[0]+1, j[1]):\n",
    "                        tag[k] = 'ADM'\n",
    "                    \n",
    "                elif label == 'book':\n",
    "                    tag[j[0]] = 'BS'\n",
    "                    tag[j[1]] = 'BE'\n",
    "                    for k in range(j[0]+1, j[1]):\n",
    "                        tag[k] = 'BM'\n",
    "\n",
    "                elif label == 'company':\n",
    "                    tag[j[0]] = 'CS'\n",
    "                    tag[j[1]] = 'CE'\n",
    "                    for k in range(j[0]+1, j[1]):\n",
    "                        tag[k] = 'CM'\n",
    "\n",
    "                elif label == 'game':\n",
    "                    tag[j[0]] = 'GS'\n",
    "                    tag[j[1]] = 'GE'\n",
    "                    for k in range(j[0]+1, j[1]):\n",
    "                        tag[k] = 'GM'\n",
    "\n",
    "                elif label == 'government':\n",
    "                    tag[j[0]] = 'GOS'\n",
    "                    tag[j[1]] = 'GOE'\n",
    "                    for k in range(j[0]+1, j[1]):\n",
    "                        tag[k] = 'GOM'\n",
    "\n",
    "                elif label == 'movie':\n",
    "                    tag[j[0]] = 'MS'\n",
    "                    tag[j[1]] = 'ME'\n",
    "                    for k in range(j[0]+1, j[1]):\n",
    "                        tag[k] = 'MM'\n",
    "\n",
    "                elif label == 'name':\n",
    "                    tag[j[0]] = 'NS'\n",
    "                    tag[j[1]] = 'NE'\n",
    "                    for k in range(j[0]+1, j[1]):\n",
    "                        tag[k] = 'NM'\n",
    "\n",
    "                elif label == 'organization':\n",
    "                    tag[j[0]] = 'OS'\n",
    "                    tag[j[1]] = 'OE'\n",
    "                    for k in range(j[0]+1, j[1]):\n",
    "                        tag[k] = 'OM'\n",
    "\n",
    "                elif label == 'position':\n",
    "                    tag[j[0]] = 'PS'\n",
    "                    tag[j[1]] = 'PE'\n",
    "                    for k in range(j[0]+1, j[1]):\n",
    "                        tag[k] = 'PM'\n",
    "                else:\n",
    "                    tag[j[0]] = 'SS'\n",
    "                    tag[j[1]] = 'SE'\n",
    "                    for k in range(j[0]+1, j[1]):\n",
    "                        tag[k] = 'SM'\n",
    "    \n",
    "    dic['text'] = text\n",
    "    dic['tag'] = tag\n",
    "    dev_dataset.append(dic)  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [],
   "source": [
    "trans_dict = {\n",
    "        'E':'O',\n",
    "        'ADS':'B-ADDRESS',\n",
    "        'ADM':'I-ADDRESS',\n",
    "        'ADE':'I-ADDRESS',\n",
    "        'BS':'B-BOOK',\n",
    "        'BM':'I-BOOK',\n",
    "        'BE':'I-BOOK',\n",
    "        'CS':'B-COM',\n",
    "        'CM':'I-COM',\n",
    "        'CE':'I-COM',\n",
    "        'GS':'B-GAME',\n",
    "        'GM':'I-GAME',\n",
    "        'GE':'I-GAME',\n",
    "        'GOS':'B-GOV',\n",
    "        'GOM':'I-GOV',\n",
    "        'GOE':'I-GOV',\n",
    "        'MS':'B-MOVIE',\n",
    "        'MM':'I-MOVIE',\n",
    "        'ME':'I-MOVIE',\n",
    "        'NS':'B-NAME',\n",
    "        'NM':'I-NAME',\n",
    "        'NE':'I-NAME',\n",
    "        'OS':'B-ORG',\n",
    "        'OM':'I-ORG',\n",
    "        'OE':'I-ORG',\n",
    "        'PS':'B-POS',\n",
    "        'PM':'I-POS',\n",
    "        'PE':'I-POS',\n",
    "        'SS':'B-SCENE',\n",
    "        'SM':'I-SCENE',\n",
    "        'SE':'I-SCENE',\n",
    "        \n",
    "}\n",
    "def transform(tag_):\n",
    "    TAG = []\n",
    "    for i in tag_:\n",
    "        TAG.append(trans_dict[i])\n",
    "    return TAG"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [],
   "source": [
    "from tqdm import tqdm_notebook"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "<ipython-input-24-b37ba159d29b>:3: TqdmDeprecationWarning: This function will be removed in tqdm==5.0.0\n",
      "Please use `tqdm.notebook.tqdm` instead of `tqdm.tqdm_notebook`\n",
      "  for k in tqdm_notebook(range(len(dev_dataset)),desc='process：'):\n"
     ]
    },
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "934e83f0c9ef4e08a8125c898d255acd",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "HBox(children=(HTML(value='process：'), FloatProgress(value=0.0, max=1343.0), HTML(value='')))"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n"
     ]
    }
   ],
   "source": [
    "test_data = []\n",
    "true_data = []\n",
    "for k in tqdm_notebook(range(len(dev_dataset)),desc='process：'):\n",
    "    #print()\n",
    "    #print(i['text'])\n",
    "    i = dev_dataset[k]\n",
    "    true_data.append(transform(i['tag']))\n",
    "    try:\n",
    "        test_data.append(transform(to_seq(i['text'], init_mat, transform_mat, singleword_mat)))\n",
    "        #print(cut(i['text'], to_seq(i['text'], init_mat, transform_mat, singleword_mat)))\n",
    "        #print()\n",
    "    except:\n",
    "        test_data.append(['O' for _ in range(len(i['text']))])\n",
    "        #print('存在未登录字，无法进行识别！')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "              precision    recall  f1-score   support\n",
      "\n",
      "     ADDRESS       0.30      0.34      0.32       373\n",
      "        BOOK       0.64      0.36      0.46       154\n",
      "         COM       0.52      0.52      0.52       378\n",
      "        GAME       0.66      0.71      0.68       295\n",
      "         GOV       0.51      0.57      0.54       247\n",
      "       MOVIE       0.55      0.60      0.57       151\n",
      "        NAME       0.55      0.53      0.54       465\n",
      "         ORG       0.54      0.53      0.53       367\n",
      "         POS       0.63      0.61      0.62       433\n",
      "       SCENE       0.46      0.38      0.42       209\n",
      "\n",
      "   micro avg       0.53      0.52      0.52      3072\n",
      "   macro avg       0.54      0.51      0.52      3072\n",
      "weighted avg       0.53      0.52      0.52      3072\n",
      "\n"
     ]
    }
   ],
   "source": [
    "print(classification_report(true_data, test_data))\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "彭小军认为，国内银行现在走的是台湾的发卡模式，先通过跑马圈地再在圈的地里面选择客户，\n",
      "{'name': ['彭小军'], 'address': ['台湾']}\n",
      "\n",
      "\n",
      "温格的球队终于又踢了一场经典的比赛，2比1战胜曼联之后枪手仍然留在了夺冠集团之内，\n",
      "{'name': ['温格'], 'organization': ['曼联']}\n",
      "\n",
      "\n",
      "突袭黑暗雅典娜》中Riddick发现之前抓住他的赏金猎人Johns，\n",
      "{'game': ['突袭黑暗雅典娜》'], 'name': ['Riddick', 'Johns']}\n",
      "\n",
      "\n",
      "郑阿姨就赶到文汇路排队拿钱，希望能将缴纳的一万余元学费拿回来，顺便找校方或者教委要个说法。\n",
      "{'address': ['。']}\n",
      "\n",
      "\n",
      "我想站在雪山脚下你会被那巍峨的雪山所震撼，但你一定要在自己身体条件允许的情况下坚持走到牛奶海、\n",
      "存在未登录字，无法进行识别！\n",
      "\n",
      "吴三桂演义》小说的想像，说是为牛金星所毒杀。……在小说中加插一些历史背景，\n",
      "{'book': ['吴三桂演义》']}\n",
      "\n",
      "\n",
      "看来各支一二流的国家队也开始走出欧洲杯后低迷，从本期对阵情况看，似乎冷门度也不太高，你认为呢？\n",
      "{'goverment': ['国家队'], 'organization': ['欧洲杯']}\n",
      "\n",
      "\n",
      "就天涯网推出彩票服务频道是否是业内人士所谓的打政策“擦边球”，记者近日对此事求证彩票监管部门。\n",
      "{'address': ['。']}\n",
      "\n",
      "\n",
      "市场仍存在对网络销售形式的需求，网络购彩前景如何？为此此我们采访业内专家程阳先生。\n",
      "{'position': ['专家'], 'name': ['程阳']}\n",
      "\n",
      "\n",
      "组委会对中国区预选赛进行了抽签分组，并且对本次抽签进行了全程直播。\n",
      "{'position': ['组委'], 'address': ['中国区']}\n",
      "\n",
      "\n",
      "根据北京市消防局的说法，此次火灾主要原因是责任单位违规燃放礼花弹，燃放期间民警多次劝阻未果。\n",
      "{'goverment': ['北京市消防局']}\n",
      "\n",
      "\n",
      "本报讯（记者王吉瑛）双色球即将出台新规，一等奖最高奖金可达到1000万元。昨天，中彩中心透露，\n",
      "{'position': ['记者'], 'name': ['王吉瑛'], 'company': ['中彩中心']}\n",
      "\n",
      "\n",
      "结果上周六他们主场0：3惨败给了中游球队瓦拉多利德，近7个多月以来西甲首次输球。\n",
      "{'organization': ['瓦拉多利德', '西甲']}\n",
      "\n",
      "\n",
      "价格高昂的大钻和翡翠消费为何如此火？通灵珠宝总裁沈东军认为，这与原料稀缺有直接关系。“\n",
      "{'company': ['通灵珠宝'], 'position': ['总裁'], 'name': ['沈东军']}\n",
      "\n",
      "\n",
      "是目前表现最好的锋线组合之一，而沃尔科特往往能够让对手的整个左边肋疲于防守，以目前枪手的能力和状态，\n",
      "{'organization': ['沃尔科特'], 'address': ['，']}\n",
      "\n",
      "\n",
      "爱情公寓》预售票房破亿01:29爱情公寓口碑大跌，恶评如潮…01:07电影版爱情公寓糟起诉?还…\n",
      "{'movie': ['爱情公寓》', '爱情公寓', '爱情公寓']}\n",
      "\n",
      "\n",
      "如今着整个潮白河区域环境的巨大变化和环首都经济圈的快速推进，夏威夷水岸1号的稀缺价值越来越明显，\n",
      "{'address': ['潮白河区域'], 'scene': ['夏威夷水岸']}\n",
      "\n",
      "\n",
      "Svensson在接受媒体采访时表示，CAPCOM并没有放弃《街霸》电影系列，将推出新的《\n",
      "{'company': ['Svensson'], 'organization': ['CAPCOM'], 'game': ['《街霸》', '《']}\n",
      "\n",
      "\n",
      "莫斯科中央陆军vs波兹南、拉科vs费耶诺德、加拉塔萨雷vs梅塔利斯特，\n",
      "{'organization': ['莫斯科', '拉科vs费耶诺德', '加拉塔萨雷vs梅塔利斯特'], 'goverment': ['央陆军'], 'address': ['波兹南']}\n",
      "\n",
      "\n",
      "这也让很多业主据此认为，雅清苑是政府公务员挤对了国家的经适房政策。\n",
      "{'scene': ['雅清苑'], 'goverment': ['政府'], 'position': ['公务员']}\n",
      "\n",
      "\n",
      "至大约2008年5月，san-hothk在星展银行的账户内的资金已不足以让san-hot\n",
      "{'name': ['san-hothk', 'san-hot'], 'company': ['星展银行']}\n",
      "\n",
      "\n",
      "新绝代双骄之鱼戏江湖篇》简体中文版即将在2009年新年1月上市！\n",
      "{'game': ['新绝代双骄之鱼戏江湖篇》']}\n",
      "\n",
      "\n",
      "虚幻引擎3动作游戏《黑光》新作公布\n",
      "{'movie': ['《黑光》']}\n",
      "\n",
      "\n",
      "在先进行的魔兽3项目决赛中，受到线下赛现场的观众与临时降雨气候变化的原因，\n",
      "{'game': ['魔兽3']}\n",
      "\n",
      "\n",
      "市住建委相关负责人昨天表示，《北京市公共租赁房管理办法》已经获得市委常委会审议原则通过，\n",
      "{'goverment': ['市住建委', '市委常委会'], 'position': ['相关负责人'], 'address': ['北京市'], 'book': ['房管理办法》']}\n",
      "\n",
      "\n",
      "一边是羊群散布的牧场荒原，等过了阿波罗湾apollobay进入雨林，\n",
      "{'scene': ['阿波罗湾apollobay']}\n",
      "\n",
      "\n",
      "证券时报记者唐曜华\n",
      "{'book': ['证券时报'], 'position': ['记者'], 'company': ['唐曜华']}\n",
      "\n",
      "\n",
      "现役DotA明星选手，担任SOLO位的世界第一影魔Pis（卜严骏），\n",
      "{'game': ['DotA', 'SOLO位的世界', '魔Pis'], 'address': ['，']}\n",
      "\n",
      "\n",
      "宝玺，6月4日在北京保利拍至5656万元。\n",
      "{'address': ['北京']}\n",
      "\n",
      "\n",
      "玩dota，你会发现敢死队根本没有用处玩imba，你会发现敢死队是制胜的关键\n",
      "{'game': ['dota', 'imba']}\n",
      "\n",
      "\n",
      "都灵vsac米兰推荐：3/1\n",
      "{'organization': ['都灵vsac米兰']}\n",
      "\n",
      "\n",
      "郭庆祥：我们看画廊如果有好的艺术家，好的作品进去，我们是真正想去买好的艺术作品，而不是投资，\n",
      "{'name': ['郭庆祥'], 'position': ['艺术家']}\n",
      "\n",
      "\n",
      "但是这毕竟是个别现象。北京公安部门统计的数字显示，青少年犯罪中76%的人都是网络成瘾患者。\n",
      "{'goverment': ['北京公安部门'], 'address': ['。']}\n",
      "\n",
      "\n",
      "游戏背景设为1942年日军“五一”大扫荡后，八路军根据地大幅度减少，损失严重，\n",
      "{'goverment': ['日军', '八路军']}\n",
      "\n",
      "\n",
      "记者随后致电该校财务处求证，但一名工作人员却表示完全不知道学生办信用卡一事，更否认办卡与财务处有关。\n",
      "{'position': ['记者', '学生'], 'goverment': ['财务处', '财务处']}\n",
      "\n",
      "\n",
      "腾讯新闻昨天金庸逝世江湖再无金大侠订阅号消息昨天【15条】王者荣耀福利抢鲜看!队友的京东京东jd.\n",
      "{'company': ['腾讯', '京东京东jd.'], 'name': ['金庸'], 'scene': ['世江湖'], 'game': ['王者荣耀']}\n",
      "\n",
      "\n",
      "先锋盾带给DOTA的是一种革命。\n",
      "{'game': ['DOTA']}\n",
      "\n",
      "\n",
      "大众软件：古墓谜题游戏《球》的乐趣\n",
      "{'book': ['大众软件'], 'address': ['古墓'], 'movie': ['《球》']}\n",
      "\n",
      "\n",
      "下面再来看看这个动了《机器人瓦力》的奶酪的《通缉》（wanted）。本片以超过劲敌的约16100＄\n",
      "{'movie': ['《机器人瓦力》'], 'address': ['＄']}\n",
      "\n",
      "\n",
      "也将给自身带来用户分流之痛。“事实上，新资料片无法及时上线对于魔兽世界是存在一定影响的。”\n",
      "{'game': ['魔兽世界']}\n",
      "\n",
      "\n",
      "资历最老的游戏，《棒球巨星》系列也像FIFA、NBALive、\n",
      "{'game': ['《棒球巨星》', 'FIFA'], 'name': ['NBALive']}\n",
      "\n",
      "\n",
      "陈艳萍：买西山的人的购房需求，主要有两种，一种是养老型的需求，很多人认为在西山是能够颐养天年的，\n",
      "{'name': ['艳萍'], 'address': ['西山', '西山', '，']}\n",
      "\n",
      "\n",
      "光大三家银行信用卡专业人士分别就境外购买1000欧元、1000英镑和1万港币的商品，\n",
      "{'company': ['光大三家银行'], 'position': ['专业人']}\n",
      "\n",
      "\n",
      "4、雷吉纳vsac米兰推荐：0\n",
      "{'organization': ['雷吉纳vsac米兰']}\n",
      "\n",
      "\n",
      "现在的阿森纳恐怕不能再给人以强队的信心，但教授的神经也真是够硬，在英超夺冠几无希望的情况下，\n",
      "{'organization': ['阿森纳', '英超'], 'position': ['教授']}\n",
      "\n",
      "\n",
      "日前美国军方于对外宣布将会推出第三部军事训练游戏《美国陆军3》(America's\n",
      "{'goverment': ['美国军'], 'position': ['军事训练'], 'game': ['《美国陆军3》', \"(America's\"]}\n",
      "\n",
      "\n",
      "欧美知名游戏开发公司“Relic”，继成功推出史上最畅销的二战即时战略游戏《英雄连》\n",
      "{'company': ['游戏开发公司'], 'name': ['Relic”'], 'game': ['《英雄连》']}\n",
      "\n",
      "\n",
      "《火爆狂飙：天堂》是由CriterionGames制作，\n",
      "{'game': ['《火爆狂飙：天堂》', 'CriterionGames']}\n",
      "\n",
      "\n",
      "更感谢各位媒体的朋友给我们精品和乐成中心捧场。我一向很少在官方的场面讲话，因为我背不了开场白，\n",
      "{}\n",
      "\n",
      "\n",
      "金石开：阿森纳实际受到国家队的冲击并不大，像范佩西只在与挪威的下半场才替补出场，\n",
      "{'name': ['金石开', '范佩西'], 'organization': ['阿森纳', '挪威'], 'goverment': ['国家队']}\n",
      "\n",
      "\n",
      "表身刻有代表日内瓦钟表匠freresoltramare的“fo”字样。\n",
      "{'organization': ['日内瓦'], 'address': ['。']}\n",
      "\n",
      "\n",
      "此次共有314件书画作品上拍。陆俨少1977年作品《雁荡瀑布》就将以80万起拍。“\n",
      "{'address': ['“']}\n",
      "\n",
      "\n",
      "信用卡违规套现的“灰色地带”有望在法律上得到更清晰的界定。最高人民法院（下称“最高法”）\n",
      "{'goverment': ['人民法院']}\n",
      "\n",
      "\n",
      "曾参与打击私彩行动的一位长春警官告诉记者，过去公开销售非法彩票出具打印或手写的书面凭证，\n",
      "{'address': ['长春'], 'position': ['警官', '记者']}\n",
      "\n",
      "\n",
      "主角米勒在游戏开始被日军俘虏，并且亲眼看着队友被残忍地杀害，就当厄运即将降临之时，\n",
      "{'position': ['主角'], 'name': ['米勒'], 'goverment': ['日军'], 'address': ['，']}\n",
      "\n",
      "\n",
      "阳光社区记者宁彪/摄影报道\n",
      "{'address': ['阳光社区'], 'position': ['记者']}\n",
      "\n",
      "\n",
      "导致泗水的砭石受到追捧，价格突然上涨。而泗水县文化市场综合执法局颜鲲表示，根据监控，\n",
      "{'goverment': ['泗水县文化市场综合执法局'], 'address': ['，']}\n",
      "\n",
      "\n",
      "为了回应不久前DOTA2粉丝在游戏开发者Twitter上对于DOTA2配队机制的质疑，\n",
      "{'game': ['DOTA2', 'DOTA2'], 'position': ['发者'], 'name': ['Twitter']}\n",
      "\n",
      "\n",
      "还是得到一定程度的实现。而最近香港电影的相关新闻，也逐渐的多了起来，如银都机构出品的《十分钟情》（\n",
      "{'address': ['香港'], 'movie': ['《十分钟情》']}\n",
      "\n",
      "\n",
      "如果你是个海岛控，强烈建议前往仙本那，不管是休闲度假还是深潜浮潜，这里都要比亚庇更有优势，\n",
      "{'scene': ['海岛', '亚庇']}\n",
      "\n",
      "\n",
      "现在我就很愿意乘地铁，纽约、东京、香港，现在的北京，而且越来越快，像我们这个十号线，在乐成中心下面，\n",
      "{'address': ['纽约', '东京', '香港', '北京']}\n",
      "\n",
      "\n",
      "下午的行程从马久邑出发，行程为马久邑-富美邑-磻溪-古生-海舌-沙村-喜洲，\n",
      "存在未登录字，无法进行识别！\n",
      "\n",
      "《波斯王子：时之沙》是好莱坞知名制片杰瑞布凯默继《神鬼奇航》、《国家宝藏》\n",
      "{'movie': ['《波斯王子：时之沙》', '《神鬼奇航》', '《国家宝藏》'], 'address': ['好莱坞'], 'name': ['杰瑞布凯默']}\n",
      "\n",
      "\n",
      "有多少人在给外人介绍Dota时会说，这是电子竞技目前最火热的项目，而不是目前最火热的游戏？\n",
      "{'game': ['Dota']}\n",
      "\n",
      "\n",
      "猴魁岛由两座小岛组成，中间一条木桥相连，有趣的是每逢下雨的时候，水位上涨会把木桥淹掉，\n",
      "{'address': ['魁岛', '木桥', '，']}\n",
      "\n",
      "\n",
      "最早华贸中心开始建成的时候，那个位置大家也不是很认可，\n",
      "{'address': ['华贸中心']}\n",
      "\n",
      "\n",
      "王府井书店北京市东城区王府井大街218号\n",
      "{'address': ['王府井书店北京市东城区王府井大街218号']}\n",
      "\n",
      "\n",
      "侵蚀洱海边其他水泵站的岸基台阶，最后只留下这一个记录当年的故事。\n",
      "存在未登录字，无法进行识别！\n",
      "\n",
      "我也观察到其它监管部门的监管指标对行业持续发展和结构调整的作用。比方说银行贷款，\n",
      "{'goverment': ['监管部门']}\n",
      "\n",
      "\n",
      "在2007年，与新韩银行签订了3年之内赞助50亿韩元的协定。退出了“新韩银行职业联赛”\n",
      "{'company': ['韩银行', '韩银行']}\n",
      "\n",
      "\n",
      "第一财经日报》记者分析。\n",
      "{'book': ['财经日报》'], 'position': ['记者']}\n",
      "\n",
      "\n",
      "工艺行业协会要加强政策宣传和技术引导，对已售出的红木家具产品，有严重质量问题的，要主动召回服务，\n",
      "{'company': ['工艺行']}\n",
      "\n",
      "\n",
      "由林达集团投资开发的海渔广场就位于东四环内四方桥南，首期推出精装公寓海洋公寓——\n",
      "{'company': ['林达集团'], 'scene': ['海渔广场'], 'address': ['东四环内四方桥南'], 'movie': ['精装公寓海洋公寓']}\n",
      "\n",
      "\n",
      "但深发展已经成为国内第一个实际盈利的信用卡部门。\n",
      "{'company': ['深发展']}\n",
      "\n",
      "\n",
      "在审查时也是有所限制的，改编于好莱坞版惊险片《一线声机》的、陈木胜导演的《保持通话》便体现了这点，\n",
      "{'movie': ['好莱坞版惊险片', '《一线声机》', '《保持通话》'], 'name': ['陈木胜'], 'position': ['导演']}\n",
      "\n",
      "\n",
      "电影：《杀手：代号47》\n",
      "{'movie': ['《杀手：代号47》']}\n",
      "\n",
      "\n",
      "其他俱乐部笔者都是亲自查看了俱乐部最新官方资料后给出的结论）。\n",
      "{'organization': ['俱乐部', '俱乐部'], 'position': ['笔者']}\n",
      "\n",
      "\n",
      "对此，记者拨通了该银行信用卡的客服中心的电话热线，工作人员表示，银行业一向的规定是只要（持卡人）\n",
      "{'position': ['记者']}\n",
      "\n",
      "\n",
      "每年年底都是跳槽的高峰，没想到今年年底DOTA圈也和大众圈接轨了。一个个惊爆的消息，\n",
      "{'game': ['DOTA']}\n",
      "\n",
      "\n",
      "一代武侠小说泰斗查良镛金庸于30日下午病逝，享年94岁。“飞雪连天射白鹿，笑书神侠倚碧鸳”\n",
      "{'name': ['查良镛', '金庸'], 'book': ['飞雪连天射白鹿', '笑书神侠倚碧鸳']}\n",
      "\n",
      "\n",
      "如果一个照片里只有烽火台的话就会显得很呆板。如果只拍长城，又会觉得太单一，没有磅礴的气势。\n",
      "{'address': ['。']}\n",
      "\n",
      "\n",
      "三部无意过问奥斯卡奖的新片异常冷场，《卷土重来》（thecomebacks）、《萨拉和神秘时辰》（\n",
      "{'organization': ['奥斯卡'], 'game': ['《卷土重来》'], 'name': ['（thecomebacks）'], 'book': ['《萨拉和神秘时辰》']}\n",
      "\n",
      "\n",
      "电影版》和《街霸：春丽传》并没有成功，你怎么认为？\n",
      "{'movie': ['电影版》', '《街霸：春丽传》']}\n",
      "\n",
      "\n",
      "的时间会去玩玩星际2。\n",
      "{'game': ['星际2']}\n",
      "\n",
      "\n",
      "核战的点子已经被《辐射》系列拿去用了，于是，《怒潮》选择了用行星撞击地球来诠释世界末日。\n",
      "{'game': ['《辐射》', '《怒潮》']}\n",
      "\n",
      "\n",
      "3。线下报名，到银兴网吧晨曦店吧台填写报名表\n",
      "{'address': ['银兴网吧晨曦店吧']}\n",
      "\n",
      "\n",
      "福建省公安厅经侦总队在福州、乌鲁木齐、深圳、北京、济南等五市同时展开搜捕，经过六天六夜的连续作战，\n",
      "{'goverment': ['福建省公安厅经侦总队'], 'address': ['福州', '深圳', '北京'], 'organization': ['乌鲁木齐']}\n",
      "\n",
      "\n",
      "姜山：切尔西在周中做客意大利时1比3惨败给近况糟糕的罗马，\n",
      "{'name': ['姜山'], 'organization': ['切尔西', '罗马']}\n",
      "\n",
      "\n",
      "而哈文则去了天津电视台。每次做完节目，李咏就马不停蹄地往天津赶，朋友和同事们有事要找李咏，\n",
      "存在未登录字，无法进行识别！\n",
      "\n",
      "夏威夷火山国家公园hawaiivolcanoesnationalpark可以在天上看，\n",
      "{'scene': ['夏威夷火山国家公园'], 'name': ['awaiivolcanoesnationalpark']}\n",
      "\n",
      "\n",
      "有吉林的玉米加工企业负责人告诉记者，鉴于此前加工企业没有原料可收，7月初，\n",
      "{'address': ['吉林的玉米'], 'company': ['工企业'], 'position': ['负责人', '记者']}\n",
      "\n",
      "\n",
      "摆渡车在公园入口大厅可以乘坐，如图所示，第二站是迷你小农场，第三站是狮子园，\n",
      "{'address': ['公园入口大厅'], 'scene': ['狮子园']}\n",
      "\n",
      "\n",
      "约翰森回到厄普顿公园球场都要面对主队球迷的嘘声，缺少索尔-坎贝尔在后防压阵，估计庞贝军团很难爆大冷。\n",
      "存在未登录字，无法进行识别！\n",
      "\n",
      "中国内地邮票由原来国家邮政局改成由现在的中国邮政集团公司印制发行，从此政企分开，\n",
      "{'organization': ['中国内地邮票'], 'goverment': ['国家邮政局'], 'company': ['中国邮政集团公司']}\n",
      "\n",
      "\n",
      "内地分行也可以申请（除了深圳总行，广州的招行广州分行营业部也有授权）。他们收取了你的《申请表》\n",
      "{'company': ['深圳总行', '招行广州分行营业部'], 'address': ['广州']}\n",
      "\n",
      "\n",
      "电子艺界在向美国证券交易委员会(SEC)提交的监管文件中称：“有基于此，\n",
      "{'goverment': ['美国证券交易委员会'], 'game': ['SEC)']}\n",
      "\n",
      "\n",
      "首先恭喜《色，戒》突破重围，跃上龙门，李安“奥斯卡最佳导演”的桂冠果然没白戴。同时提名最佳导演的《\n",
      "{'movie': ['《色，戒》'], 'address': ['上龙门'], 'name': ['李安'], 'organization': ['奥斯卡'], 'position': ['导演', '导演'], 'game': ['《']}\n",
      "\n",
      "\n",
      "他站起身来，将现场周边环境全方位地审视了一遍，发现浮尸的地点，位于玄武湖公园翠洲环湖小路的左侧，\n",
      "{'address': ['武湖公园翠洲环湖小路的左侧']}\n",
      "\n",
      "\n",
      "《天方夜谭》中的故事来源，已经无从考证，但是，可以肯定的是，这些故事是吸收了埃及、\n",
      "{'book': ['《天方夜谭》']}\n",
      "\n",
      "\n",
      "公安部经济犯罪侦查局副局长张涛在接受《法制日报》记者采访时说，上面的案例并非个案，\n",
      "{'goverment': ['公安部经济犯罪侦查局'], 'position': ['副局长', '记者'], 'name': ['张涛'], 'book': ['《法制日报》']}\n",
      "\n"
     ]
    }
   ],
   "source": [
    "for i in dev_dataset[0:100]:\n",
    "    print()\n",
    "    print(i['text'])\n",
    "    try:\n",
    "        print(cut(i['text'], to_seq(i['text'], init_mat, transform_mat, singleword_mat)))\n",
    "        print()\n",
    "    except:\n",
    "        print('存在未登录字，无法进行识别！')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
